import socket
import os

def handle_client_connection(client_socket):
    # 接收客户端请求的文件名
    file_name = client_socket.recv(1024).decode()
    if os.path.isfile(file_name):
        with open(file_name, 'rb') as file:
            data = file.read()
            client_socket.sendall(data)
    else:
        client_socket.sendall(b'File not found')

def main():
    server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    server_address = ('10.43.133.92', 8888)
    server_socket.bind(server_address)
    print("UDP服务器开始工作了.....")
    server_socket.listen(1)

    while True:
        client_socket, client_address = server_socket.accept()
        handle_client_connection(client_socket)
        client_socket.close()

if __name__ == '__main__':
    main()